{include file="public/header" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
<style type="text/css">
    #des, #des input {
        width: 40px;
        text-align: center;
    }

    #id {
        width: 78px;
    }

    .bs-checkbox {
        width: 36px;
        height: 40px
    }

    .fixed-table-toolbar .columns, .fixed-table-toolbar .search {
        margin-left: 0px;
        margin-top: 0px
    }

    #title span {
        float: right;
    }

    .asdlkjasd {
        background: #1ab394;
        color: #fff
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content {:config('adminClass.main')}">
    <div class="ibox float-e-margins">
        {include file="public/tophead"}
        {include file="public/top" /}
        <div class="ibox-content">
            {include file="public/topsection"}
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="fixed-table-toolbar">
                        <a class="btn btn-default btn-outline {present name='status'}{else /}asdlkjasd{/present}"
                           href="{:url('objectrecords')}">所&nbsp;&nbsp;有</a>
                        <a class="btn btn-default btn-outline {eq name='status' value='1'}asdlkjasd{/eq}"
                           href="{:url('objectrecords',['status'=>'1'])}{present name='paymethod'}/paymethod/{$paymethod}{/present}">中&nbsp;&nbsp;奖</a>
                        <a class="btn btn-default btn-outline {eq name='status' value='0'}asdlkjasd{/eq}"
                           href="{:url('objectrecords',['status'=>'0'])}{present name='paymethod'}/paymethod/{$paymethod}{/present}">未中奖</a>
                    </div>
                    <div class="fixed-table-toolbar">
                        <a class="btn btn-default btn-outline {present name='paymethod'}{else /}asdlkjasd{/present}"
                           href="{:url('objectrecords')}">所&nbsp;&nbsp;有</a>
                        <a class="btn btn-default btn-outline {eq name='paymethod' value='1'}asdlkjasd{/eq}"
                           href="{:url('objectrecords',['paymethod'=>'1'])}{present name='status'}/status/{$status}{/present}">金&nbsp;&nbsp;币</a>
                        <a class="btn btn-default btn-outline {eq name='paymethod' value='2'}asdlkjasd{/eq}"
                           href="{:url('objectrecords',['paymethod'=>'2'])}{present name='status'}/status/{$status}{/present}">积&nbsp;&nbsp;分</a>
                    </div>
                    <div class="fixed-table-toolbar">
                        <form  method="get" action="">
                            <div class="pull-left search">
                                <div class="columns columns-right btn-group pull-left">
                                    <select class="form-control" name="type">
                                        <option value="user_id" {php}if(input('?param.type')){if(input('param.type')=='user_id'){echo "selected";} }{/php}>用户id</option>
                                        <option value="description" {php}if(input('?param.type')){if(input('param.type')=='description'){echo "selected";} }{/php}>奖项描述</option>
                                    </select>
                                </div>
                                {php}
                                if(input('?param.name')){
                                {/php}
                                <div class="pull-right search">
                                    <a class="btn btn-w-m btn-link" href="{:url('objectrecords')}">返回列表</a>
                                </div>{php}
                                }
                                {/php}
                                <div class="pull-right search">
                                    <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px" class="btn btn-default btn-outline" type="submit">搜索</button>
                                </div>
                                <div class="pull-right search">
                                    <input class="form-control input-outline" type="text"
                                           {php}
                                           if(input('?param.name')){
                                    if(input('param.name')){
                                    echo "value='".input('name')."'";
                                    }

                                    }
                                    {/php}
                                    name="name" placeholder="搜索">
                                </div>


                            </div>
                        </form>
                    </div>
                    <div class="example">
                        <form class="form-horizontal" method="post">
                            <table data-toggle="table">
                                <thead>
                                <tr>
                                    <th data-align="center" data-width="8%">ID</th>
                                    <th data-align="center" data-width="10%">用户</th>
                                    <th data-align="center" data-width="10%">支付金额</th>
                                    <th data-align="center" data-width="10%">支付方式</th>
                                    <th data-align="center">奖项描述</th>
                                    <th data-align="center" data-width="10%">抽奖时间</th>
                                    <th data-align="center" data-width="10%">今日抽奖次数</th>
                                    <th data-align="center" data-width="10%">昨日抽奖次数</th>
                                    <th data-align="center" data-width="10%">7日内抽奖次数</th>
                                    <th data-align="center" data-width="10%">30天内抽奖次数</th>
                                    <th data-align="center" data-width="10%">总共中奖次数</th>
                                </tr>
                                </thead>
                                <tbody id="form">
                                {volist name="data" id="v"}
                                <tr id="id{$v.id}" class="class">
                                    <td>{$v.id}</td>
                                    <td >
                                        <a onclick="member('{$v.user_id}')" style="color:#40BCF7">{$v.username}<br />(ID:{$v.user_id})</a>
                                    </td>
                                    <td>{$v.price}</td>
                                    <td>{$v.type == 1 ? '金币' : '积分'}</td>
                                    <td>{$v.description}</td>
                                    <td> 
                                        <span {php}if(date('Y-m-d')==date('Y-m-d', $v['time']))echo 'style="color: #ed5565"';{/php}>
                                            {:date('Y-m-d H:i', $v.time)}
                                        </span>
                                    </td>
                                    <td>
                                        {:db('turn_table_of_objects_records')->where(['user_id'=>$v.user_id])->whereTime('time','today')->cache(10)->count()}
                                    </td>
                                    <td>
                                        {:db('turn_table_of_objects_records')->where(['user_id'=>$v.user_id])->whereTime('time','yesterday')->cache(10)->count()}
                                    </td>
                                    <td>
                                        {:db('turn_table_of_objects_records')->where(['user_id'=>$v.user_id])->whereTime('time','-7 days')->cache(10)->count()}
                                    </td>
                                    <td>
                                        {:db('turn_table_of_objects_records')->where(['user_id'=>$v.user_id])->whereTime('time','-30 days')->cache(10)->count()}
                                    </td>
                                    <td>
                                        {:db('turn_table_of_objects_records')->where(['user_id'=>$v.user_id])->where('goods_id > 0')->cache(10)->count()}
                                    </td>
                                </tr>
                                {/volist}
                                </tbody>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
            <hr>
            <div class="row row-lg">
                <div class="col-sm-12 pages">{$page}</div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}

<script type="text/javascript">


    function member(id)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("member/index")}?search=id&name='+id
            });
        });
    }

</script>
